package com.yaoxuguang.concurrence.wait_notify.thread_commumication_pipeline;

import java.io.IOException;
import java.io.PipedWriter;

/**
 * @author yaoxuguang
 * @Title: yao-interview
 * @Package com.yaoxuguang.concurrence.wait_notify.thread_commumication_pipeline
 * @Description: 通过管道进行通讯--字符流--写出数据
 * @date 2018年12月24日10:59
 */
public class WriteData {
    public void writeMethod(PipedWriter pipedWriter){
        try {
            System.out.println("write...");
            for (int i = 0; i < 300; i++) {
                String outData=""+(i+1);
                pipedWriter.write(outData);
                System.out.print(outData);
            }
            System.out.println();
            pipedWriter.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
